package com.itheima.stock.config;

import com.itheima.stock.properties.IdWorkerProperties;
import com.itheima.stock.util.IdWorkers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *  id生成器
 */
@Configuration
public class IdWorkersConfiguration {

    @Bean
    public IdWorkers idWorkers(IdWorkerProperties idWorkerProperties){
        return new IdWorkers(idWorkerProperties.getMachineId(),idWorkerProperties.getDatacenterId());
    }

}
